<?php
class View{
	function render($action = null, $layout = null, $file = null){
		if(!empty($this->viewData)){
			extract($this->viewData);
		}
		$filename='./app/views/'.$GLOBALS['ENV']['params']['controller'].'/'.$GLOBALS['ENV']['params']['action'].'.ctp';
		load('./lib/helper/html.php');
		$html=new htmlHelper();
		ob_start();
		load($filename,array('html'=>$html));
		$out=ob_get_clean();
		if($layout==null){
			$layout=$this->layout;
		}
		$filename='./app/views/layouts/'.$layout.'.ctp';
		ob_start();
		load($filename,array('content_for_layout'=>$out,'html'=>$html));
		$content_layout=ob_get_clean();
		return $content_layout;
	}
}